from django.http import HttpResponse,HttpResponseRedirect
from django.shortcuts import render
from django.urls import reverse

from .models import Music
# Create your views here.
def music_view(request):
    music=Music.objects.filter(isActive=True)
    return render(request,'music/music_view.html',locals())


def del_music(request):
    music_id=request.GET.get('id')
    music=Music.objects.get(id=music_id)
    music.isActive=False
    music.save()
    url=reverse('mymusic')
    return HttpResponseRedirect(url)